import com.gasstation.user.Role


class BootStrap {

	def init = { servletContext ->
		String[] roles = [
			"ROLE_TRACKER",
			"ROLE_STATISTICS",
			"ROLE_CUSTOMER_MANAGER",
			"ROLE_AUTOCOMPLETE_MANAGER",
			"ROLE_USER_MANAGER"
		]
		roles.each {
			if (!Role.findByAuthority("${it}"))
				new Role(authority: "${it}").save(flush: true)
		}
		environments {
			development { DummyData.cleanUpAndCreateDummyData() }
		}
	}
	def destroy = {
	}
}
